<?php

require '../init.inc.php';

$feedurl = str_replace('{buzz}', 'basicthinking', TWITTER_SEARCH);
$feedurl = str_replace('{items}', 100, $feedurl);
$feedurl = str_replace('{page}', 1, $feedurl);

$feed = new SimplePie;
$feed->set_feed_url($feedurl);
$feed->enable_cache(false);
$feed->init();
$feed->handle_content_type();

echo 'basicthinking';

// Now calculate days
foreach ($feed->get_items() as $item):

        $date = $item->get_date('Ymd');
        if (isset($mystats[$date])):
                $mystats[$date] = $mystats[$date] + 1;
        else:
                $mystats[$date] = 1;
        endif;

endforeach;

$chart = new googChart();
$chart->setChartAttrs( array(
    'type' => 'bar-vertical',
    'data' => $mystats,
    'size' => array( 300, 200 )
    ));
echo $chart;


printf('<pre>%s</pre>', print_r($mystats, 1));

echo "<hr />";

foreach ($feed->get_items() as $item):

        echo '(' . $item->get_date() . ') ' . $item->get_title() . "<br />";

endforeach;

?> 
